[6.19.z] hostgroup nonadmin viewer read - #20886
Merged
Satellite-QE merged 1 commit intoFeb 26, 2026
Merged
Conversation
hostgroups: new test for non-admin viewer role Verifies: SAT-38451 New test for bug "Non-admin users on Satellite with viewer role, unable to see the hostgroup." Ensure that non-admin user with viewer role can see hostgroup created by admin user. Also added new `UserFactory` class to help with more reusable user fixtures. (cherry picked from commit 0da20ab)
Collaborator
Author
|
trigger: test-robottelo |
Satellite-QE
deleted the
cherry-pick-6.19.z-0da20aba3a316b090dff2355ba0b152b2a213a94
branch
February 26, 2026 09:42
Collaborator
Author
|
PRT Result |
Contributor
Reviewer's GuideAdds UI test coverage to verify that a non-admin user with the Viewer role can see host groups created by an admin, and introduces reusable fixtures (including a UserFactory and hostgroup fixture with org/location) to support this scenario. Sequence diagram for non-admin Viewer user reading host groupsequenceDiagram
actor AdminUser
actor ViewerUser
participant UITest as UITestRunner
participant SatUI as Satellite_UI
participant SatAPI as Satellite_API
UITest->>AdminUser: Use admin credentials
AdminUser->>SatUI: Login
SatUI->>SatAPI: Authenticate admin
SatAPI-->>SatUI: Admin session
AdminUser->>SatUI: Create host group (with org and location)
SatUI->>SatAPI: HostGroup.create(organization, location)
SatAPI-->>SatUI: Host group created
UITest->>ViewerUser: Use viewer credentials (fixture module_user_viewer)
ViewerUser->>SatUI: Login
SatUI->>SatAPI: Authenticate viewer (non-admin, Viewer role)
SatAPI-->>SatUI: Viewer session
ViewerUser->>SatUI: Navigate to Host Groups page
SatUI->>SatAPI: HostGroup.search(filters: organization, location)
SatAPI-->>SatUI: List including admin-created host group
SatUI-->>ViewerUser: Host group visible in UI
Class diagram for new UserFactory and related fixturesclassDiagram
class UserFactory {
+create_user(target_sat, params) User
}
class Satellite {
api
}
class APIUser {
+admin : bool
+default_organization
+location
+organization
+role
+password
+create()
}
class Role {
}
class HostGroup {
+organization
+location
+create()
}
class viewer_role_fixture {
}
class default_viewer_role_fixture {
}
class module_user_viewer_fixture {
}
class module_hostgroup_with_org_loc_fixture {
}
UserFactory ..> APIUser : creates
Satellite "1" *-- "many" APIUser : api.User
Satellite "1" *-- "many" Role : api.Role
Satellite "1" *-- "many" HostGroup : api.HostGroup
viewer_role_fixture ..> Role : returns
default_viewer_role_fixture ..> UserFactory : uses
default_viewer_role_fixture ..> viewer_role_fixture : uses
module_user_viewer_fixture ..> UserFactory : uses
module_user_viewer_fixture ..> viewer_role_fixture : uses
module_hostgroup_with_org_loc_fixture ..> HostGroup : creates
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
test_positive_non_admin_viewer_role_read, indexing directly intosession.hostgroup.search(...)[0]['Name']will raise anIndexErrorif the host group isn’t found; consider first asserting that the search result is non-empty (or using a more defensive pattern like checkingany()over the results) so the failure clearly indicates that the host group was not visible rather than surfacing as an index error.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `test_positive_non_admin_viewer_role_read`, indexing directly into `session.hostgroup.search(...)[0]['Name']` will raise an `IndexError` if the host group isn’t found; consider first asserting that the search result is non-empty (or using a more defensive pattern like checking `any()` over the results) so the failure clearly indicates that the host group was not visible rather than surfacing as an index error.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherrypick of PR: #20875
Problem Statement
New test coverage for bug SAT-38451: Non-admin users on Satellite with viewer role, unable to see the hostgroup.
Solution
Ensure that non-admin user with viewer role can see hostgroup created by admin user.
Also added new
UserFactoryclass to help with more reusable user fixtures.PRT
Summary by Sourcery
Add UI test coverage ensuring non-admin users with the Viewer role can see host groups created by an admin, and introduce reusable user and hostgroup fixtures to support this scenario.
New Features:
Enhancements:
Tests: